<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class UserPointsLog extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_points_logs', function(Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->index()->comment('用户ID');
            $table->tinyInteger('type')->comment('类型,1奖励，2扣除');
            $table->float('points', 11, 2)->comment('变更积分');
            $table->float('remain_points', 11, 2)->comment('剩余积分');
            $table->tinyInteger('reason_type')->comment('积分变更原因，后期定义，如 1=>签到');
            $table->string('remark')->comment('备注');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('user_points_logs');
    }
}
